package com.cx.mapper;

import com.cx.dto.UserDTO;
import com.cx.dto.UserPageDTO;
import com.cx.pojo.Project;
import com.cx.pojo.User;
import com.cx.util.ResultUtil;
import com.cx.vo.JobAndCountVO;
import com.cx.vo.PermissionsVO;
import com.cx.vo.StatusAndCountVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface UserMapper {
    int register(UserDTO userDTO);

    User selectUserByUsername(String username);

    @Select("select * from user where id = #{id}")
    User selectById(long id);

    int updateById(UserDTO userDTO);

    int insert(User user);

    Page<User> pageQuery(UserPageDTO userPageDTO);

    @Delete("delete from user where id = #{id}")
    int deleteUserById(Long id);

    List<JobAndCountVO> selectJobAndCount();

    @Select("select distinct status from user")
    List<Integer> getAuths();

    @Update("update user set status = #{status} where id = #{id}")
    int authorization(@Param("id") Integer id, @Param("status") Integer status);

    @Select("select id,username from user where status = 2")
    List<User> selectManager();

    List<StatusAndCountVO> selectStatusAnCountVO();
}
